package com.bingxue.edu.management.shop.model.resp;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author panbo
 * @since 2024/11/28
 */
@Data
public class RefundRecordExportResp {

    @ColumnWidth(28)
    @ExcelProperty(value = "退款单号")
    private String id;

    @ColumnWidth(24)
    @ExcelProperty(value = "退款时间")
    private LocalDateTime refundTime;

    @ExcelProperty(value = "学生姓名")
    private String studentName;

    @ColumnWidth(16)
    @ExcelProperty(value = "家长电话")
    private String parentPhone;

    @ColumnWidth(66)
    @ExcelProperty(value = "退课班级")
    private String className;

    @ExcelProperty(value = "主讲老师")
    private String leadTeacherName;

    @ExcelProperty(value = "退课次数")
    private Integer cancelLessonCount;

    @ExcelProperty(value = "退款金额")
    private BigDecimal refundPrice;

    @ExcelProperty(value = "退款账户")
    private String finAccountName;

    @ExcelProperty(value = "三方账户")
    private String outTradeNo;

    @ExcelProperty(value = "创建人")
    private String createUserName;

    @ExcelProperty(value = "关联订单号")
    private String orderId;

    public static RefundRecordExportResp of(RefundRecordListResp from) {
        RefundRecordExportResp resp = new RefundRecordExportResp();
        resp.setId(from.getId());
        resp.setRefundTime(from.getRefundTime());
        resp.setStudentName(from.getStudent().getName());
        resp.setParentPhone(from.getStudent().getParentPhone());
        resp.setClassName(from.getClassInfo().getName());
        resp.setLeadTeacherName(from.getClassInfo().getLeadTeacherName());
        resp.setCancelLessonCount(from.getCancelLessonIndexes().size());
        resp.setRefundPrice(from.getRefundPrice());
        resp.setFinAccountName(from.getFinAccount().getName());
        resp.setOutTradeNo(from.getOutTradeNo());
        resp.setCreateUserName(from.getCreateUserName());
        resp.setOrderId(from.getOrderId());
        return resp;
    }
}
